<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>计算器</title>
    </head>
    <body>
        <div>
            <form method="get" action="http://localhost:3000/rectangle">
                高度：<input id="height" type="text">
                <br>
                宽度：<input id="width" type="text">
                <br>
                <input id="calculate" type="button" value="计算">
                <br>
                周长：<input id="perimeter" type="text">
                <br>
                面积：<input id="area" type="text">
            </form>
        </div>
    </body>
    <script>
        const calculate = document.getElementById('calculate');
        const height = document.getElementById('height');
        const width = document.getElementById('width');
        const perimeter = document.getElementById('perimeter');
        const area = document.getElementById('area');

        

        calculate.onclick = ()=>{
            fetch('http://localhost:3000/rectangle')
            .then(res => res.json())
            .then(res => {
                console.log(res)
            })
        }
    </script>
</html>